<template>
	<div class="app-container">
		<div class="toatst" style="width: 100%;height: 100%;position: fixed; z-index: 9999; " v-if="loadToast">
			<i class="el-icon-loading"
				style="font-size: 60px; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #000;"></i>
		</div>
		<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
			<el-form-item label="出库编号" prop="outTaskNo">
				<el-input v-model="queryParams.outTaskNo" placeholder="请输入出库编号" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
		<!-- 	<el-form-item label="出库原因" prop="outWhSortCode">
				<el-input v-model="queryParams.outWhSortCode" placeholder="请输入出库原因" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item> -->
			<el-form-item label="操作人" prop="operationUserId">
				<el-select v-model="queryParams.operationUserId" placeholder="请选择操作人" clearable>
					<el-option v-for="item in userList" :key="item.userId" :label="item.nickName"
						:value="item.userId"></el-option>
				</el-select>
			</el-form-item>
			<!-- <el-form-item label="单据来源" prop="taskOrderType">
				<el-select v-model="queryParams.taskOrderType" placeholder="请选择任务状态" clearable>
					<el-option v-for="dict in dict.type.task_order_type" :key="dict.value" :label="dict.label"
						:value="dict.value"></el-option>
				</el-select>
			</el-form-item> -->
			<el-form-item label="任务状态" prop="statusCode">
				<el-select v-model="queryParams.statusCode" placeholder="请选择任务状态" clearable>
					<el-option v-for="dict in dict.type.out_wh_status_code" :key="dict.value" :label="dict.label"
						:value="dict.value"></el-option>
				</el-select>
			</el-form-item>
			<!-- <el-form-item label="任务时间">
				<el-date-picker v-model="dateRange1" type="datetimerange" :picker-options="pickerOptions"
					range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
				</el-date-picker>
			</el-form-item> -->
			<el-form-item label="操作时间">
				<el-date-picker v-model="dateRange2" type="datetimerange" :picker-options="pickerOptions"
					range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
				</el-date-picker>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
				<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
			</el-form-item>
		</el-form>

		<el-row :gutter="10" class="mb8">
			<el-col :span="1.5">
				<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
					v-hasPermi="['meter:mdOutTask:add']">新增</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="success" plain icon="el-icon-switch-button" size="mini" :disabled="single"
					@click="startExecution" v-hasPermi="['meter:mdOutTask:editStatus']">开始执行</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="warning" plain icon="el-icon-finished" size="mini" :disabled="single" @click="accomplished"
					v-hasPermi="['meter:mdOutTask:editStatus']">任务完成</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="primary" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
					v-hasPermi="['meter:mdOutTask:edit']">修改</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
					v-hasPermi="['meter:mdOutTask:remove']">删除</el-button>
			</el-col>

			<!-- <el-col :span="1.5">
				<el-button type="success" plain icon="el-icon-sort" size="mini" @click="downloadData"
					v-hasPermi="['meter:mdOutTask:downloadJsonMdOutTask']">下载数据</el-button>
			</el-col> -->
			<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
		</el-row>

		<el-table v-loading="loading" :data="mdOutTaskList" @selection-change="handleSelectionChange">
			<el-table-column type="selection" width="55" align="center" />
			<el-table-column label="出库标识" align="center" prop="outTaskId" />
			<el-table-column label="出库编号" align="center" prop="outTaskNo" min-width="200px" />
			<!-- <el-table-column label="申请单号" align="center" prop="relaId" min-width="200px" /> -->
			<!-- <el-table-column label="出库原因" align="center" prop="outWhSortCode" min-width="250px" /> -->
			<el-table-column label="操作人" align="center" prop="nickName" min-width="90px" />
			<el-table-column label="操作时间" align="center" prop="operationDate" width="180">
				<template slot-scope="scope">
					<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d}') }}</span>
				</template>
			</el-table-column>
			<el-table-column label="任务状态" align="center" prop="statusCode">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.out_wh_status_code" :value="scope.row.statusCode" />
				</template>
			</el-table-column>
		<!-- 	<el-table-column label="单据来源" align="center" prop="taskOrderType">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.task_order_type" :value="scope.row.taskOrderType" />
				</template>
			</el-table-column> -->
			<!-- <el-table-column label="出库数量" align="center" prop="outNumber" min-width="90px" /> -->
			<!-- <el-table-column label="任务时间" align="center" prop="taskDate" width="180">
				<template slot-scope="scope">
					<span>{{ parseTime(scope.row.taskDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
				</template>
			</el-table-column> -->
			<!-- <el-table-column label="资产大类" align="center" prop="assetsCategory">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.md_assets_category" :value="scope.row.assetsCategory" />
				</template>
			</el-table-column>
			<el-table-column label="接线方式" align="center" prop="wiringMode" width="150">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.md_wiring_mode" :value="scope.row.wiringMode" />
				</template>
			</el-table-column>
			<el-table-column label="电压" align="center" prop="voltCode" width="150">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.md_volt_code" :value="scope.row.voltCode" />
				</template>
			</el-table-column>
			<el-table-column label="电流" align="center" prop="currentCode" width="150">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.md_current_code" :value="scope.row.currentCode" />
				</template>
			</el-table-column>
			<el-table-column label="有功等级" align="center" prop="apPreLevelCode" width="100">
				<template slot-scope="scope">
					<dict-tag :options="dict.type.md_ap_pre_level_code" :value="scope.row.apPreLevelCode" />
				</template>
			</el-table-column> -->
			<el-table-column label="备注" align="center" prop="remark" min-width="220px" />
			<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right"
				min-width="350px">
				<template slot-scope="scope">
					<el-button size="mini" type="text" icon="el-icon-upload2" @click="handleImport(scope.row)"
						v-hasPermi="['eter:mdOutTaskDetails:import']">导入</el-button>
					<el-button size="mini" type="text" icon="el-icon-download" @click="handleExport(scope.row)"
						v-hasPermi="['meter:mdOutTaskDetails:export']">导出</el-button>
					<el-button size="mini" type="text" icon="el-icon-chat-line-square" @click="taskDetails(scope.row)"
						v-hasPermi="['meter:mdOutTaskDetails:export']">添加明细</el-button>
					<!-- <el-button size="mini" type="text" icon="el-icon-document" @click="processingDetails(scope.row)"
						v-hasPermi="['meter:mdOutTaskDetails:edit']">处理明细</el-button> -->
            <el-button size="mini" type="text" icon="el-icon-document" @click="watchInfoDetails(scope.row)"
            	v-hasPermi="['meter:mdOutTaskDetails:edit']">查看明细</el-button>
				</template>
			</el-table-column>
		</el-table>

		<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
			@pagination="getList" />

		<!-- 添加或修改出库任务对话框 -->
		<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
			<el-form ref="form" :model="form" :rules="rules" label-width="80px">
				<el-form-item label="出库编号" prop="outTaskNo">
					<el-input v-model="form.outTaskNo" placeholder="自动生成" maxlength="50" readonly :disabled="true" />
				</el-form-item>
				<!-- <el-form-item label="出库原因" prop="taskOrderType">
					<el-input v-model="form.taskOrderType" placeholder="请输入出库原因" maxlength="50" />
				</el-form-item> -->
			<!-- 	<el-form-item label="操作人" prop="operationUserId">
					<el-select v-model="form.operationUserId" placeholder="请选择操作人">
						<el-option v-for="item in userList" :key="item.deptId" :label="item.nickName"
							:value="item.userId"></el-option>
					</el-select>
				</el-form-item> -->
			<!-- 	<el-form-item label="任务时间" prop="taskDate">
					<el-date-picker clearable v-model="form.taskDate" type="datetime" value-format="yyyy-MM-dd hh:mm:ss"
						placeholder="请选择任务时间">
					</el-date-picker>
				</el-form-item> -->
		 	<el-form-item label="资产大类" prop="assetsCategory">
					<el-select v-model="form.assetsCategory" placeholder="请选择资产大类" clearable
						:disabled="disableAssetCategory" @change="assetsCategoryChange">
						<el-option v-for="dict in dict.type.md_assets_category" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
			<!--	<el-form-item label="接线方式" prop="wiringMode" v-show="show">
					<el-select v-model="form.wiringMode" filterable placeholder="请选择接线方式" clearable>
						<el-option v-for="dict in dict.type.md_wiring_mode" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="电压" prop="voltCode" v-show="show">
					<el-select v-model="form.voltCode" filterable placeholder="请选择电压" clearable>
						<el-option v-for="dict in dict.type.md_volt_code" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="电流" prop="currentCode" v-show="show">
					<el-select v-model="form.currentCode" filterable placeholder="请选择电流" clearable>
						<el-option v-for="dict in dict.type.md_current_code" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="有功等级" prop="apPreLevelCode" v-show="show">
					<el-select v-model="form.apPreLevelCode" filterable placeholder="请选择有功等级" clearable>
						<el-option v-for="dict in dict.type.md_ap_pre_level_code" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="出库数量" prop="outNumber">
					<el-input-number v-model="form.outNumber" placeholder="出库数量" />
				</el-form-item> -->
				<el-form-item label="备注" prop="remark">
					<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm">确 定</el-button>
				<el-button @click="cancel">取 消</el-button>
			</div>
		</el-dialog>

		<!-- 导入对话框 -->
		<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
			<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
				:action="upload.url + '?isCoverSupport=' + upload.isCoverSupport + '&&outTaskNo=' + upload.outTaskNo"
				:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
				:auto-upload="false" drag>
				<i class="el-icon-upload"></i>
				<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
				<div class="el-upload__tip text-center" slot="tip">
					<div class="el-upload__tip" slot="tip">
						<el-checkbox v-model="upload.isCoverSupport" /> 是否覆盖已经存在的用户数据
					</div>
					<span>仅允许导入xls、xlsx格式文件。</span>
					<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
						@click="importTemplate" v-hasPermi="['meter:mdOutTaskDetails:importTemplate']">下载模板</el-link>
				</div>
			</el-upload>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitFileForm">确 定</el-button>
				<el-button @click="upload.open = false">取 消</el-button>
			</div>
		</el-dialog>

		<!-- 添加明细对话框 -->
		<el-dialog :title="text" :visible.sync="opened" width="1200px" append-to-body @close='closeDetails'>
			<el-row :gutter="10" class="mb8">
				<el-col :span="1.5">
					<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="detailsAdd">添加</el-button>
				</el-col>
				<el-col :span="1.5">
					<el-button type="danger" plain icon="el-icon-delete" size="mini"
						@click="addDetailsDelete">删除</el-button>
				</el-col>
			</el-row>
			<el-table v-loading="loading" :data="electricOutDetailsList" @selection-change="oneChange" v-if="asset == '01'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
        <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
        <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="110px" />
				<el-table-column label="类别" align="center" prop="sortCode">
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
		<!-- 		<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="transformerOutDetailsList" @selection-change="twoChange"
				v-if="asset == '02'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" />
				<el-table-column label="类别" align="center" prop="sortCode">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
					</template>
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
			<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="terminalOutDetailsList" @selection-change="threeChange"
				v-if="asset == '03'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
				<el-table-column label="型号" align="center" prop="modelCode" min-width="130px" />
				<el-table-column label="类型" align="center" prop="typeCode" />
			<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="moduleOutDetailsList" @selection-change="fourChange" v-if="asset == '04'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" />
				<el-table-column label="关联设备类别" align="center" prop="assocCategory" min-width="110px" />
				<el-table-column label="关联设备条码号" align="center" prop="assocRfid" min-width="200px" />
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="concentratorOutDetailsList" @selection-change="fiveChange"
				v-if="asset == '05'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
				<el-table-column label="类型" align="center" prop="typeCode" />
				<el-table-column label="型号" align="center" prop="modelCode" min-width="180px" />
			<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="otherOutDetailsList" @selection-change="sixChange" v-if="asset == '10'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="设备类别" align="center" prop="equipCateg" />
				<el-table-column label="设备条形码" align="center" prop="" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="beSure">确 定</el-button>
				<el-button @click="closeDetails">取 消</el-button>
			</div>
		</el-dialog>

		<!-- 添加任务明细对话框 -->
		<el-dialog :title="topic" :visible.sync="untie" width="1200px" append-to-body>
			<el-form :model="queryParam" ref="searchReset" size="small" :inline="true" v-show="showSearch"
				label-width="68px">
			<!-- 	<el-form-item label="库房" prop="whId">
					<el-select v-model="queryParam.whId" placeholder="请选择库房" @change="whIdChange" clearable>
						<el-option v-for="dict in option" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="库区" prop="whAreaId">
					<el-select v-model="queryParam.whAreaId" placeholder="请选择库区" @change="whAreaIdChange" clearable>
						<el-option v-for="dict in options" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="存放区" prop="storeAreaId">
					<el-select v-model="queryParam.storeAreaId" placeholder="请选择存放区" @change="storeAreaIdChange" clearable>
						<el-option v-for="dict in messageOption" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="储位" prop="storeLocId">
					<el-select v-model="queryParam.storeLocId" placeholder="请选择储位" clearable>
						<el-option v-for="dict in storageOption" :key="dict.value" :label="dict.label"
							:value="dict.value"></el-option>
					</el-select>
				</el-form-item> -->
				<el-form-item label="条形码" prop="rfidNo">
					<el-input v-model="queryParam.rfidNo" placeholder="条形码" clearable />
				</el-form-item>
				<el-form-item>
					<el-button type="primary" icon="el-icon-search" size="mini" @click="searchFor">搜索</el-button>
					<el-button icon="el-icon-refresh" size="mini" @click="resetTing">重置</el-button>
				</el-form-item>
			</el-form>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addDetailsSelectionChange"
				v-if="asset == '01'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="meterId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="110px" />
				<el-table-column label="类别" align="center" prop="sortCode">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.emi_meter_sort" :value="scope.row.sortCode" />
					</template>
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
			<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaname" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addTransformerDetailsSelectionChange"
				v-if="asset == '02'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="itId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" />
				<el-table-column label="类别" align="center" prop="sortCode">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
					</template>
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addAcquisitionDetailsSelectionChange"
				v-if="asset == '03'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="lcEquipId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
				<el-table-column label="型号" align="center" prop="modelCode" min-width="130px" />
				<el-table-column label="类型" align="center" prop="typeCode" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addConcentratorDetailsSelectionChange"
				v-if="asset == '04'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="moduleId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" />
				<el-table-column label="关联设备类别" align="center" prop="assocCategory" min-width="110px" />
				<el-table-column label="关联设备条码号" align="center" prop="assocRfid" min-width="200px" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addCommunicationDetailsSelectionChange"
				v-if="asset == '05'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="concentratorId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="220px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="出厂编号" align="center" prop="madeNo" min-width="220px" />
				<el-table-column label="类型" align="center" prop="typeCode" />
				<el-table-column label="型号" align="center" prop="modelCode" min-width="180px" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
				<!-- <el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<el-table v-loading="loading" :data="detailsAddList" @selection-change="addOtherDetailsSelectionChange"
				v-if="asset == '10'">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="设备标识" align="center" prop="otherMaterialId" />
				<el-table-column label="设备类别" align="center" prop="equipCateg" />
				<el-table-column label="设备条形码" align="center" prop="barCode" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
				<el-table-column label="业务状态" align="center" prop="serviceStatus" min-width="100px">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.service_status" :value="scope.row.serviceStatus" />
					</template>
				</el-table-column>
			<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="110px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="100px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" /> -->
			</el-table>
			<pagination v-show="num > 0" :total="num" :page.sync="queryParam.pageNum" :limit.sync="queryParam.pageSize"
				:page-sizes="[10, 50, 100, 500]" @pagination="detailsAdd" />
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="define">确 定</el-button>
				<el-button @click="untie = false">取 消</el-button>
			</div>
		</el-dialog>

		<!-- 处理明细弹出层 -->
		<el-dialog :title="processingText" :visible.sync="processing" width="1200px" append-to-body
			@close='closeProcessing'>
			<el-row :gutter="10" class="mb8">
				<el-col :span="1.5">
					<el-button type="primary" plain icon="el-icon-upload2" size="mini" :disabled="several"
						@click="warehousingExecution">出库执行</el-button>
				</el-col>
				<el-col :span="1.5">
					<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="several"
						@click="deleteProcessingDetails">删除</el-button>
				</el-col>
			</el-row>
			<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '01'">
				<el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
				<el-table-column label="类别" align="center" prop="sortCode">
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
				<el-table-column label="库房" align="center" prop="whName" min-width="200px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" />
				<el-table-column label="是否完成" align="center" prop="isComplete">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
					</template>
				</el-table-column>
				<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
					<template slot-scope="scope">
						<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
					</template>
				</el-table-column>
				<el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
					</template>
				</el-table-column>
			</el-table>
			<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '02'">
				<el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
				<el-table-column label="类别" align="center" prop="sortCode">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
					</template>
				</el-table-column>
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
				<el-table-column label="库房" align="center" prop="whName" min-width="200px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" />
				<el-table-column label="是否完成" align="center" prop="isComplete">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
					</template>
				</el-table-column>
				<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
					<template slot-scope="scope">
						<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
					</template>
				</el-table-column>
				<el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
					</template>
				</el-table-column>
			</el-table>
			<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails"
				v-if="cateGory != '02' && cateGory != '01'">
				<el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
				<el-table-column label="设备标识" align="center" prop="assetsId" />
				<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
				<el-table-column label="类别" align="center" prop="sortCode" />
				<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
				<el-table-column label="库房" align="center" prop="whName" min-width="200px" />
				<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
				<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
				<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
				<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" />
				<el-table-column label="是否完成" align="center" prop="isComplete">
					<template slot-scope="scope">
						<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
					</template>
				</el-table-column>
				<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
					<template slot-scope="scope">
						<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
					</template>
				</el-table-column>
			</el-table>
			<pagination v-show="figure > 0" :total="figure" :page.sync="inquireAbout.pageNum"
				:limit.sync="inquireAbout.pageSize" :page-sizes="[10, 50, 100, 500]" @pagination="processingDetail" />
			<div slot="footer" class="dialog-footer">
				<!-- <el-button type="primary" @click="startBeSureExecution">确 定</el-button> -->
				<el-button @click="closeProcessing">返 回</el-button>
			</div>
		</el-dialog>

    <!-- 查看明细弹出层 -->
    <el-dialog :title="watchInfoText" :visible.sync="watchInfo" width="1200px" append-to-body
    	@close='closeWatchInfo'>
    	<el-row :gutter="10" class="mb8">
    	</el-row>
    	<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '01'">
    		<el-table-column label="设备标识" align="center" prop="assetsId" />
    		<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
    		<el-table-column label="类别" align="center" prop="sortCode">
    		</el-table-column>
    		<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
    		<!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
    		<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
    		<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
    		<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
    		<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
    		<el-table-column label="是否完成" align="center" prop="isComplete">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
    			</template>
    		</el-table-column>
    		<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
    			<template slot-scope="scope">
    				<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
    			</template>
    		</el-table-column>
    		<!-- <el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
    			</template>
    		</el-table-column> -->
    	</el-table>
    	<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails" v-if="cateGory == '02'">
    		<el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
    		<el-table-column label="设备标识" align="center" prop="assetsId" />
    		<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
    		<el-table-column label="类别" align="center" prop="sortCode">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.tf_sort_code" :value="scope.row.sortCode" />
    			</template>
    		</el-table-column>
    		<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
    		<!-- <el-table-column label="库房" align="center" prop="whName" min-width="200px" />
    		<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
    		<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
    		<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
    		<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
    		<el-table-column label="是否完成" align="center" prop="isComplete">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
    			</template>
    		</el-table-column>
    		<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
    			<template slot-scope="scope">
    				<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
    			</template>
    		</el-table-column>
    		<!-- <el-table-column label="是否正常入库" align="center" prop="isNormal" width="180">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.md_is_normal" :value="scope.row.isNormal" />
    			</template>
    		</el-table-column> -->
    	</el-table>
    	<el-table v-loading="loading" :data="detailsList" @selection-change="processDetails"
    		v-if="cateGory != '02' && cateGory != '01'">
    		<el-table-column type="selection" width="55" align="center" :selectable="selectedChange" />
    		<el-table-column label="设备标识" align="center" prop="assetsId" />
    		<el-table-column label="条形码" align="center" prop="rfidNo" min-width="200px" />
       <el-table-column label="设备码" align="center" prop="equipCode" min-width="220px" />
       <el-table-column label="设备名称" align="center" prop="equipName" min-width="550px" />
    		<el-table-column label="类别" align="center" prop="sortCode" />
    		<el-table-column label="类型" align="center" prop="typeCode" min-width="140px" />
    	<!-- 	<el-table-column label="库房" align="center" prop="whName" min-width="200px" />
    		<el-table-column label="库区" align="center" prop="whAreaName" min-width="150px" />
    		<el-table-column label="存放区" align="center" prop="storeAreaName" min-width="110px" />
    		<el-table-column label="储位编号" align="center" prop="storeLocNo" min-width="110px" />
    		<el-table-column label="储位" align="center" prop="storeLocName" min-width="110px" /> -->
    		<el-table-column label="是否完成" align="center" prop="isComplete">
    			<template slot-scope="scope">
    				<dict-tag :options="dict.type.in_is_complete" :value="scope.row.isComplete" />
    			</template>
    		</el-table-column>
    		<el-table-column label="完成时间" align="center" prop="operationDate" width="180">
    			<template slot-scope="scope">
    				<span>{{ parseTime(scope.row.operationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
    			</template>
    		</el-table-column>
    	</el-table>
    	<pagination v-show="figure > 0" :total="figure" :page.sync="inquireAbout.pageNum"
    		:limit.sync="inquireAbout.pageSize" :page-sizes="[10, 50, 100, 500]" @pagination="processingDetail" />
    	<div slot="footer" class="dialog-footer">
    		<el-button @click="closeWatchInfo">返 回</el-button>
    	</div>
    </el-dialog>
	</div>
</template>

<script>
import {
	listMdOutTask,
	getMdOutTask,
	delMdOutTask,
	addMdOutTask,
	updateMdOutTask,
	modifyIssueTaskStatus,
	addReceiptDetails,
	queryDetailsList,
	delMdInTaskDetails,
	startBeSureDetailsExecution,
	jsonMdOutTask
} from "@/api/meter/mdOutTask";
import {
	getToken
} from "@/utils/auth";
import {
	listUser
} from "@/api/system/user"
import {
	listMdMeter
} from "@/api/meter/mdMeter";
import {
	listMdIt
} from "@/api/meter/mdIt";
import {
	listMdLcEquip
} from "@/api/meter/mdLcEquip";
import {
	listMdComModule
} from "@/api/meter/mdComModule";
import {
	listMdConcentrator
} from "@/api/meter/mdConcentrator";
import {
	listMdOtherMaterial
} from "@/api/meter/mdOtherMaterial";
import {
	selectMdWhInfo,
	selectMdStorageAreaInfo,
	selectMdSaInfo,
	selectStorageLocation
} from "@/api/meter/mdWhInfo";

export default {
	name: "MdOutTask",
	dicts: ["md_assets_category", "out_wh_status_code", "emi_meter_sort", "tf_sort_code", "service_status",
		"in_is_complete", "md_wiring_mode", "md_volt_code", "md_current_code", "md_ap_pre_level_code", "md_is_normal",
		"task_order_type"
	],
	data() {
		return {
			// 遮罩层
			loading: true,
			// 选中数组
			ids: [],
			codeIds: [],
			// 日期范围
			dateRange1: [],
			dateRange2: [],
			//是否显示
			show: false,
			//是否禁用
			disableAssetCategory: false,
			// 非单个禁用
			single: true,
			// 非多个禁用
			multiple: true,
			// 显示搜索条件
			showSearch: true,
			// 总条数
			total: 0,
			//上传时遮罩层
			loadToast: false,
			//处理明细中间库标识
			equipId: "",
			// 出库任务表格数据
			mdOutTaskList: [],
			// 弹出层标题
			title: "",
			// 是否显示弹出层
			open: false,
			// 是否显示添加明细弹出层
			opened: false,
			//出库编号
			taskNo: "",
			//添加明细标题
			text: "",
			//出库任务资产大类
			asset: "",
			//任务明细添加数据
			detailsAddList: [],
			//任务明细添加标题
			topic: "",
			//是否显示任务明细添加弹出层
			untie: false,
			//添加任务明细总条数
			num: 0,
			//添加任务明细选中数组
			detailsSelection: [],
			//添加明细数据
			electricOutDetailsList: [],
			transformerOutDetailsList: [],
			terminalOutDetailsList: [],
			moduleOutDetailsList: [],
			concentratorOutDetailsList: [],
			otherOutDetailsList: [],
			//选中数据集合
			selectionArray: [],
			//是否显示处理明细弹出层
			processing: false,
			//处理明细层标题
			processingText: "",

      //是否显示查看明细弹出层
      watchInfo: false,
      //查看明细层标题
      watchInfoText: "",
			//处理明细选中数组
			processingSelsctArray: [],
			//处理明细资产大类
			cateGory: "",
			//处理明细选中任务详情编号
			outTaskDetailsIds: "",
			//处理明细选中出库编号
			wareHousingNo: "",
			//处理明细非单个禁用
			alone: true,
			//处理明细非多个禁用
			several: true,
			//处理明细出库编号
			outTask: "",
			//选中数据
			detailsList: [],
			//处理明细出库ID
			taskId: "",
			//出库执行表单参数
			wareHouseForm: {},
			//单据来源
			taskOrderTypeCode: "",
			//执行表单集合
			houseForm: [],
			//处理明细查询参数
			inquireAbout: {},
			//处理明细总条数
			figure: 0,
			//添加明细查询参数
			queryParam: {
				pageNum: 1,
				pageSize: 10,
				serviceStatus: "01",
				whId: null,
				whAreaId: null,
				storeAreaId: null,
				storeLocId: null,
				voltCode: null,
				currentCode: null,
				apPreLevelCode: null,
				wiringMode: null,
				rfidNo: null,
				barCode: null,
				taskOrderType:2
			},
			//查询参数库房下拉框
			option: [],
			//查询参数库区下拉框
			options: [],
			//查询参数存放区下拉框
			messageOption: [],
			//查询参数储位下拉框
			storageOption: [],
			// 数据导入参数
			upload: {
				// 是否显示弹出层
				open: false,
				// 弹出层标题
				title: "",
				// 是否禁用上传
				isUploading: false,
				// 是否覆盖已经存在的用户数据
				isCoverSupport: 0,
				//出库编号
				outTaskNo: '',
				// 设置上传的请求头部
				headers: {
					Authorization: "Bearer " + getToken()
				},
				// 上传的地址
				url: process.env.VUE_APP_BASE_API + "/meter/mdOutTaskDetails/importData"
			},
			// 查询参数
			queryParams: {
				pageNum: 1,
				pageSize: 10,
				outTaskNo: null,
				outWhSortCode: null,
				operationUserId: null,
				operationDate: null,
				statusCode: null,
				taskDate: null,
				assetsCategory: null,
				sender: null,
				receiver: null,
				originalDept: null,
				targetDept: null,
        taskOrderType:2
			},
			// 表单参数
			  form: {taskOrderType:2},
			// 表单校验
			rules: {
				// outTaskNo: [{
				// 	required: true,
				// 	message: '出库编号不能为空',
				// 	trigger: 'blur'
				// }, {
				// 	// min: 3,
				// 	max: 50,
				// 	message: '长度不得超过50个字符',
				// 	trigger: 'blur'
				// }],
				// outNumber: [{
				// 	required: true,
				// 	message: '出库数量不能为空',
				// 	trigger: 'blur'
				// }],
				assetsCategory: [{
					required: true,
					message: '请选择资产大类',
					trigger: 'change'
				}],
				// taskDate: [{
				// 	required: true,
				// 	message: '请选择任务时间',
				// 	trigger: 'change'
				// }],
				// // operationUserId: [{
				// // 	required: true,
				// // 	message: '请选择操作人',
				// // 	trigger: 'change'
				// // }],
				// outWhSortCode: [{
				// 	required: true,
				// 	message: '出库原因不能为空',
				// 	trigger: 'blur'
				// }, {
				// 	// min: 3,
				// 	max: 50,
				// 	message: '长度不得超过50个字符',
				// 	trigger: 'blur'
				// }]
			},
			userList: [],
			pickerOptions: {
				shortcuts: [{
					text: '最近一周',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
						picker.$emit('pick', [start, end]);
					}
				}, {
					text: '最近一个月',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
						picker.$emit('pick', [start, end]);
					}
				}, {
					text: '最近三个月',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
						picker.$emit('pick', [start, end]);
					}
				}]
			},
		};
	},
	created() {
		this.getList();
	},
	methods: {
		//处理禁止选择方法
		selectedChange(row) {
			if (row.isComplete == "0") {
				return true
			} else {
				return false
			}
		},
		/** 查询出库任务列表 */
		getList() {
			this.loading = true;
			listMdOutTask(this.addDateRanges(this.queryParams, this.dateRange1, this.dateRange2)).then(response => {
				this.mdOutTaskList = response.rows;
				this.total = response.total;
				this.loading = false;
			});
			const dateRange = []
			const queryParam = {
				pageNum: 1,
				pageSize: 10
			}
			listUser(queryParam, dateRange).then(response => {
				this.userList = response.rows
			})
		},
		// 取消按钮
		cancel() {
			this.open = false;
			this.reset();
		},
		// 表单重置
		reset() {
			this.form = {
				outTaskId: null,
				outTaskNo: null,
				outWhSortCode: null,
				operationUserId: null,
				operationDate: null,
				statusCode: null,
				taskDate: null,
				assetsCategory: null,
				remark: null,
				sender: null,
				receiver: null,
				originalDept: null,
				targetDept: null,
				voltCode: null,
				currentCode: null,
				apPreLevelCode: null,
				wiringMode: null,
        taskOrderType:2

			};
			this.resetForm("form");
			this.show = false;
		},
		/** 搜索按钮操作 */
		handleQuery() {
			this.queryParams.pageNum = 1;
			this.getList();
		},
		/** 重置按钮操作 */
		resetQuery() {
			this.dateRange1 = [];
			this.dateRange2 = [];
			this.resetForm("queryForm");
			this.handleQuery();
		},
		// 多选框选中数据
		handleSelectionChange(selection) {
			this.ids = selection.map(item => item.outTaskId)
			this.taskOrderTypeCode = selection.map(item => item.taskOrderType)
			this.codeIds = selection.map(item => item.statusCode)
			this.single = selection.length !== 1
			this.multiple = !selection.length
		},
		/** 新增按钮操作 */
		handleAdd() {
			this.reset();
			this.disableAssetCategory = false;
			this.open = true;
			this.title = "添加出库任务";
		},
		assetsCategoryChange() {
			if (this.form.assetsCategory === '01') {
				this.show = true;
			} else {
				this.show = false;
			}
		},
		/** 修改按钮操作 */
		handleUpdate(row) {
			this.reset();
			this.disableAssetCategory = true;
			const outTaskId = row.outTaskId || this.ids
			getMdOutTask(outTaskId).then(response => {
				this.form = response.data;
				this.assetsCategoryChange(); //展示接线方式等
				this.open = true;
				this.title = "修改出库任务";
			});
		},
		/** 提交按钮 */
		submitForm() {
			if (this.title == "修改出库任务") {
				this.$refs["form"].validate(valid => {
					if (valid) {
						if (this.form.statusCode != 0) {
							this.$message.error('任务已执行中，不允许对数据进行修改');
						} else {
								updateMdOutTask(this.form).then(response => {
									this.$modal.msgSuccess("修改成功");
									this.open = false;
									this.getList();
								});
						}
					}
				});
			} else {
				this.$refs["form"].validate(valid => {
					if (valid) {
						addMdOutTask(this.form).then(response => {
							this.$modal.msgSuccess("新增成功");
							this.open = false;
							this.getList();
						});
					}
				});
			}
		},
		/** 删除按钮操作 */
		handleDelete(row) {
			const outTaskIds = row.outTaskId || this.ids;
			var taskOrder = ""
			this.taskOrderTypeCode.forEach(item => {
				taskOrder = item
			})
			this.$modal.confirm('是否确认删除出库任务编号为"' + outTaskIds + '"的数据项？').then(function () {
				return delMdOutTask(outTaskIds);
			}).then(() => {
				this.getList();
				this.$modal.msgSuccess("删除成功");
			}).catch(() => { });
		},
		/** 导出按钮操作 */
		handleExport(row) {
			//第一个参数为请求的接口，第二个参数为请求的时候需要的参数，第三个参数为文件的名字
			const outTaskNo = row.outTaskNo
			this.download('meter/mdOutTaskDetails/export', {
				outTaskNo
			}, `出库明细导出数据${outTaskNo}.xlsx`)
		},
		/** 导入按钮操作 */
		handleImport(row) {
			this.upload.title = "数据导入";
			this.upload.open = true;
			const outTaskNo = row.outTaskNo
			this.upload.outTaskNo = outTaskNo
		},
		/** 下载模板操作 */
		importTemplate() {
			this.download('meter/mdOutTaskDetails/importTemplate', {}, `出库导入模板${new Date().getTime()}.xlsx`)
		},
		// 文件上传中处理
		handleFileUploadProgress(event, file, fileList) {
			this.loadToast = true
			this.upload.isUploading = true;
		},
		// 文件上传成功处理
		handleFileSuccess(response, file, fileList) {
			if (response.code == 200) {
				this.upload.open = false;
				this.upload.isUploading = false;
				this.$refs.upload.clearFiles();
				this.$alert(
					`<div style="overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;">${response.msg}</div>`,
					"导入结果", {
					dangerouslyUseHTMLString: true
				});
				this.loadToast = false
				this.getList();
			} else {
				this.upload.open = false;
				this.upload.isUploading = false;
				this.$refs.upload.clearFiles();
				this.$alert(
					`<div style="overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;">${response.msg}</div>`,
					"导入结果", {
					dangerouslyUseHTMLString: true
				});
				this.loadToast = false
				this.getList();
			}
		},
		// 提交上传文件
		submitFileForm() {
			this.$refs.upload.submit();
		},
		//修改出库任务状态
		startExecution(row) {
			const task = this.ids
			const taskId = this.codeIds
			let queryParam = {}
			if (taskId == "0") {
				for (let i = 0; i < task.length; i++) {
					this.mdOutTaskList.forEach(item => {
						if (item.outTaskId == task[i]) {
							queryParam.statusCode = 1
							queryParam.outTaskId = item.outTaskId
							modifyIssueTaskStatus(queryParam).then(response => {
								if (response.code == 200) {
									this.$message({
										message: '任务开始执行',
										type: 'success'
									});
									this.getList()
								}
							})
						}
					})
				}
			} else {
				this.$message.error("您所选择的任务状态不合规")
			}
		},
		//添加明细按钮
		taskDetails(row) {
			if (row.statusCode != "0") {
				this.$message.error("该任务并非为未执行状态，禁止添加明细")
			} else {
				this.taskNo = row.outTaskNo
				this.$store.state.outTaskNo = this.taskNo
				this.asset = row.assetsCategory
				this.queryParam.voltCode = row.voltCode;
				this.queryParam.currentCode = row.currentCode;
				this.queryParam.wiringMode = row.wiringMode;
				this.queryParam.apPreLevelCode = row.apPreLevelCode;
				this.opened = true;
				this.text = "添加明细"
			}
		},
		//添加明细新增按钮
		detailsAdd() {
			selectMdWhInfo().then(response => {
				this.option = response.data
				this.whIdChange()
			})
			if (this.asset == "01") {
				listMdMeter(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加电能表数据"
					this.untie = true
					this.num = response.total
				})
			} else if (this.asset == "02") {
				listMdIt(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加互感器数据"
					this.untie = true
					this.num = response.total
				})
			} else if (this.asset == "03") {
				listMdLcEquip(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加采集终端数据"
					this.untie = true
					this.num = response.total
				})
			} else if (this.asset == "04") {
				listMdConcentrator(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加集中器数据"
					this.untie = true
					this.num = response.total
				})
			} else if (this.asset == "05") {
				listMdComModule(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加通讯模块数据"
					this.untie = true
					this.num = response.total
				})
			} else if (this.asset == "10") {
				listMdOtherMaterial(this.queryParam).then(response => {
					this.detailsAddList = response.rows
					this.topic = "添加其他物资数据"
					this.untie = true
					this.num = response.total
				})
			}
		},
		//添加明细删除按钮
		addDetailsDelete() {
			if (this.selectionArray.length == 0) {
				this.$message.error('至少选择一条数据删除');
			} else {
				if (this.asset == "01") {
					this.$store.commit("addOutDetailsDelete", {
						indexArray: this.selectionArray
					})
					this.electricOutDetailsList = this.$store.state.electricOutDetailsList
				} else if (this.asset == "02") {
					this.$store.commit("addOutDetailsDeleteOne", {
						indexArray: this.selectionArray
					})
					this.transformerOutDetailsList = this.$store.state.transformerOutDetailsList
				} else if (this.asset == "03") {
					this.$store.commit("addOutDetailsDeleteTwo", {
						indexArray: this.selectionArray
					})
					this.terminalOutDetailsList = this.$store.state.terminalOutDetailsList
				} else if (this.asset == "04") {
					this.$store.commit("addOutDetailsDeleteThree", {
						indexArray: this.selectionArray
					})
					this.moduleOutDetailsList = this.$store.state.moduleOutDetailsList
				} else if (this.asset == "05") {
					this.$store.commit("addOutDetailsDeleteFour", {
						indexArray: this.selectionArray
					})
					this.concentratorOutDetailsList = this.$store.state.concentratorOutDetailsList
				} else if (this.asset == "10") {
					this.$store.commit("addOutDetailsDeleteFive", {
						indexArray: this.selectionArray
					})
					this.otherOutDetailsList = this.$store.state.otherOutDetailsList
				}
			}
		},
		//添加电能表任务明细多选框选中数据
		addDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		//添加互感器任务明细多选框选中数据
		addTransformerDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		//添加采集终端任务明细多选框选中数据
		addAcquisitionDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		//添加集中器任务明细多选框选中数据
		addConcentratorDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		//添加通讯模块任务明细多选框选中数据
		addCommunicationDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		//添加其他物资任务明细多选框选中数据
		addOtherDetailsSelectionChange(selection) {
			this.detailsSelection = selection.map(item => item)
		},
		oneChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		twoChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		threeChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		fourChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		fiveChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		sixChange(selection) {
			this.selectionArray = selection.map(item => item)
		},
		//添加任务明细确定按钮
		define() {
			const detailsSelection = this.detailsSelection
			if (detailsSelection.length == 0) {
				this.$message.error('添加数据时至少选择一条数据');
			} else {
				if (this.asset == "01") {
					this.detailsSelection.forEach(item => {
						this.electricOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.meterId,
							equipId: item.equipId,
							isComplete: null,
							madeNo: item.madeNo,
							nickName: null,
							operationDate: null,
							originalDept: null,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.rfidNo,
							sender: null,
							sortCode: this.selectDictLabel(this.dict.type.emi_meter_sort, item.sortCode),
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.electricOutDetailsList = this.listRemoveRepeat(this.electricOutDetailsList)
					this.$store.state.electricOutDetailsList = this.electricOutDetailsList
				} else if (this.asset == "02") {
					this.detailsSelection.forEach(item => {
						this.transformerOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.itId,
							equipId: item.equipId,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							inWhSortCode: null,
							isComplete: null,
							madeNo: item.madeNo,
							nickName: null,
							operationDate: null,
							originalDept: null,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.rfidNo,
							sender: null,
							sortCode: this.selectDictLabel(this.dict.type.tf_sort_code, item.sortCode),
							statusCode: null,
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.transformerOutDetailsList = this.listRemoveRepeat(this.transformerOutDetailsList)
					this.$store.state.transformerOutDetailsList = this.transformerOutDetailsList
				} else if (this.asset == "03") {
					this.detailsSelection.forEach(item => {
						this.terminalOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.lcEquipId,
							equipId: item.equipId,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							inWhSortCode: null,
							isComplete: null,
							madeNo: item.madeNo,
							nickName: null,
							operationDate: null,
							originalDept: null,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.rfidNo,
							sender: null,
							sortCode: null,
							statusCode: null,
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.terminalOutDetailsList = this.listRemoveRepeat(this.terminalOutDetailsList)
					this.$store.state.terminalOutDetailsList = this.terminalOutDetailsList
				} else if (this.asset == "04") {
					this.detailsSelection.forEach(item => {
						this.moduleOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.moduleId,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							inWhSortCode: null,
							isComplete: null,
							madeNo: item.madeNo,
							nickName: null,
							operationDate: null,
							originalDept: null,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.rfidNo,
							sender: null,
							sortCode: null,
							statusCode: null,
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.moduleOutDetailsList = this.listRemoveRepeat(this.moduleOutDetailsList)
					this.$store.state.moduleOutDetailsList = this.moduleOutDetailsList
				} else if (this.asset == "05") {
					this.detailsSelection.forEach(item => {
						this.concentratorOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.concentratorId,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							inWhSortCode: null,
							isComplete: null,
							madeNo: item.madeNo,
							nickName: null,
							operationDate: null,
							originalDept: null,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.rfidNo,
							sender: null,
							sortCode: null,
							statusCode: null,
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.concentratorOutDetailsList = this.listRemoveRepeat(this.concentratorOutDetailsList)
					this.$store.state.concentratorOutDetailsList = this.concentratorOutDetailsList
				} else if (this.asset == "10") {
					this.detailsSelection.forEach(item => {
						this.otherOutDetailsList.push({
							assetsCategory: null,
							assetsId: item.otherMaterialId,
							outTaskDetailsId: 0,
							outTaskNo: this.taskNo,
							inWhSortCode: null,
							isComplete: null,
							madeNo: null,
							nickName: null,
							operationDate: null,
							originalDept: null,
							params: {},
							receiver: null,
							remark: null,
							repeatNumber: 0,
							rfidNo: item.barCode,
							sender: null,
							sortCode: null,
							statusCode: null,
							storeAreaId: item.storeAreaId,
							storeAreaName: item.storeAreaName,
							storeAreaNo: item.storeAreaNo,
							storeLocId: item.storeLocId,
							storeLocNo: item.storeLocNo,
							storeLocName: item.storeLocName,
							targetDept: null,
							typeCode: item.typeCode,
							whAreaId: item.whAreaId,
							whAreaName: item.whAreaname,
							whAreaNo: item.whAreaNo,
							whId: item.whId,
							whName: item.whName,
							whNo: item.whNo,
              equipCode:item.equipCode,
              equipName:item.equipName,
						})
					})
					this.otherOutDetailsList = this.listRemoveRepeat(this.otherOutDetailsList)
					this.$store.state.otherOutDetailsList = this.otherOutDetailsList
				}
				this.untie = false
			}
		},
		beSure() {
			this.$confirm('此操作将添加所有资产, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				if (this.asset == "01") {
					if (this.electricOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.electricOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.electricOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				} else if (this.asset == "02") {
					if (this.transformerOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.transformerOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.transformerOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				} else if (this.asset == "03") {
					if (this.terminalOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.terminalOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.terminalOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				} else if (this.asset == "04") {
					if (this.moduleOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.moduleOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.moduleOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				} else if (this.asset == "05") {
					if (this.concentratorOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.concentratorOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.concentratorOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				} else if (this.asset == "10") {
					if (this.otherOutDetailsList == "") {
						this.$message.error('页面中没有数据可供添加')
					} else {
						this.loadToast = true
						addReceiptDetails(this.otherOutDetailsList).then(response => {
							if (response.code == 200) {
								this.$message({
									type: 'success',
									message: '添加成功!'
								});
								this.otherOutDetailsList = []
								this.loadToast = false
								this.opened = false
							} else {
								this.$message.error('添加失败')
								this.loadToast = false
							}
						}).catch(() => {
							this.loadToast = false
						})
					}
				}
			}).catch(() => {
				this.$message({
					type: 'info',
					message: '已取消添加'
				});
			});
		},
		//去重表格选择数据
		listRemoveRepeat(x) {
			let result = [];
			for (let i = 0; i < x.length; i++) {
				let flag = true;
				let temp = x[i];
				for (let j = 0; j < result.length; j++) {
					// 普通数组 (temp === result[j])
					if (temp.assetsId === result[j].assetsId) {
						flag = false;
						break;
					}
				}
				if (flag) {
					result.push(temp);
				}
			}
			return result;
		},
		//处理明细按钮
		processingDetails(row) {
			this.outTask = row.outTaskNo
			this.taskId = row.outTaskId
			const pageSize = this.inquireAbout.pageSize
			const pageNum = this.inquireAbout.pageNum
			this.inquireAbout = {
				pageNum: pageNum,
				pageSize: pageSize,
				outTaskNo: row.outTaskNo || this.outTask
			}
			this.cateGory = row.assetsCategory
			queryDetailsList(this.inquireAbout).then(response => {
				if (response.code == 200) {
					this.detailsList = response.rows
					this.figure = response.total
					this.processing = true;
					this.processingText = "处理明细"
				}
			})
		},
		//处理明细刷新操作
		processingDetail() {
			const pageSize = this.inquireAbout.pageSize
			const pageNum = this.inquireAbout.pageNum
			this.inquireAbout = {
				pageNum: pageNum,
				pageSize: pageSize,
				outTaskNo: this.outTask
			}
			queryDetailsList(this.inquireAbout).then(response => {
				if (response.code == 200) {
					this.detailsList = response.rows
					this.figure = response.total
					this.processing = true;
					this.processingText = "处理明细"
				}
			})
		},
		//处理明细选中数据
		processDetails(selection) {
			this.processingSelsctArray = selection.map(item => item)
			this.outTaskDetailsIds = selection.map(item => item.outTaskDetailsId)
			this.wareHousingNo = selection.map(item => item.outTaskNo)
			this.equipId = selection.map(item => item.equipId)
			this.alone = selection.length !== 1
			this.several = !selection.length
		},
		//处理明细删除按钮
		deleteProcessingDetails() {
			const outTaskDetailsIds = this.outTaskDetailsIds
			const outTaskNo = this.outTask
			this.$confirm('此操作将永久删除该资产, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				return delMdInTaskDetails(outTaskDetailsIds, outTaskNo).then(response => {
					if (response.code == 200) {
						this.$message({
							type: 'success',
							message: '删除成功!'
						});
						this.processingDetail();
					}
				})
			}).catch(() => {
				this.$message({
					type: 'info',
					message: '已取消删除'
				});
			});
		},

    //查看明细按钮
    watchInfoDetails(row) {
    	this.outTask = row.outTaskNo
    	this.taskId = row.outTaskId
    	const pageSize = this.inquireAbout.pageSize
    	const pageNum = this.inquireAbout.pageNum
    	this.inquireAbout = {
    		pageNum: pageNum,
    		pageSize: pageSize,
    		outTaskNo: row.outTaskNo || this.outTask
    	}
    	this.cateGory = row.assetsCategory
    	queryDetailsList(this.inquireAbout).then(response => {
    		if (response.code == 200) {
    			this.detailsList = response.rows
    			this.figure = response.total
    			this.watchInfo = true;
    			this.watchInfoText = "查看明细"
    		}
    	})
    },
		//出库执行页面确认按钮
		warehousingExecution() {
			this.processingSelsctArray.forEach(item => {
				this.wareHouseForm = item
				this.houseForm.push(this.wareHouseForm)
			})
			let queryParams = {
				assetsCategory: this.cateGory,
				mdOutTaskDetailsList: this.houseForm,
				outTaskId: this.taskId,
				outTaskNo: this.outTask,
				equipId: this.equipId,
			}
			this.$confirm('所有资产将开始出库执行, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				return startBeSureDetailsExecution(queryParams).then(response => {
					this.loadToast = true
					if (response.code == 200) {
						this.$modal.msgSuccess("执行成功");
						this.loadToast = false
						this.toast = false;
						this.processingDetail();
					}
				}).catch(() => {
					this.toast = false;
				});
			}).catch(() => {
				this.$message({
					type: 'info',
					message: '已取消执行'
				});
			});
		},
		//关闭添加明细对话框
		closeDetails() {
			this.opened = false
			this.electricOutDetailsList = []
			this.transformerOutDetailsList = []
			this.terminalOutDetailsList = []
			this.moduleOutDetailsList = []
			this.concentratorOutDetailsList = []
			this.otherOutDetailsList = []
		},
		//关闭处理明细层
		closeProcessing() {
			this.processing = false
			this.getList()
		},

    //关闭查看明细层
    closeWatchInfo() {
    	this.watchInfo = false
    	this.getList()
    },
		//任务完成按钮
		accomplished() {
			const taskId = this.codeIds
			const task = this.ids
			let queryParam = {}
			if (taskId == "1") {
				for (let i = 0; i < task.length; i++) {
					this.mdOutTaskList.forEach(item => {
						if (item.outTaskId == task[i]) {
							queryParam.statusCode = 2
							queryParam.outTaskId = item.outTaskId
							modifyIssueTaskStatus(queryParam).then(response => {
								if (response.code == 200) {
									this.$message({
										message: '任务执行完成',
										type: 'success'
									});
									this.getList()
								}
							})
						}
					})
				}
			} else {
				this.$message.error("您所选择的任务状态不合规")
			}
		},
		//添加明细搜索按钮
		searchFor() {
			this.queryParam.pageNum = 1;
			this.queryParam.barCode = this.queryParam.rfidNo;
			this.detailsAdd()
		},
		//添加明细重置按钮
		resetTing() {
			this.resetForm("searchReset");
			this.searchFor()
		},
		//库房下拉框改变事件
		whIdChange() {
			let querySelsctParams = {}
			let option = JSON.parse(JSON.stringify(this.option))
			querySelsctParams.whId = option[0].value
			selectMdStorageAreaInfo(querySelsctParams).then(response => {
				this.options = response.data
			})
		},
		//库区下拉框改变事件
		whAreaIdChange() {
			let queryMdOptionsParams = {}
			let option = JSON.parse(JSON.stringify(this.option))
			queryMdOptionsParams.whId = option[0].value
			queryMdOptionsParams.whAreaId = this.queryParam.whAreaId
			this.queryParam.storeAreaId = null
			this.queryParam.storeLocId = null;
			this.storageOption = []
			selectMdSaInfo(queryMdOptionsParams).then(response => {
				this.messageOption = response.data
			})
		},
		//存放区下拉框改变事件
		storeAreaIdChange() {
			let queryParams = {}
			let option = JSON.parse(JSON.stringify(this.option))
			queryParams.whId = option[0].value
			queryParams.whAreaId = this.queryParam.whAreaId
			queryParams.storeAreaId = this.queryParam.storeAreaId
			this.queryParam.storeLocId = null;
			selectStorageLocation(queryParams).then(response => {
				this.storageOption = response.data
			})
		},
		//下载数据按钮
		downloadData() {
			if (this.ids.length == 0) {
				let array = [];
				this.mdOutTaskList.forEach(item => {
					if (item.statusCode == '1') {
						array.push(item.outTaskId)
					}
				})
				let queryParams = {
					outTaskIds: array
				}
				if (array != "") {
					this.$confirm('此操作将下载所有文件, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						jsonMdOutTask(queryParams).then(response => {
							if (response.code == 200) {
								this.$message({
									message: `数据成功下载至${response.msg}中`,
									type: 'success'
								});
							} else {
								this.$message.error('数据下载失败');
							}
						})
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消下载'
						});
					});
				} else {
					this.$message.error('当前页面数据全未为开始执行状态');
				}
			} else {
				let queryParams = {
					outTaskIds: JSON.parse(JSON.stringify(this.ids))
				}
				const outTaskId = this.ids
				for (let i = 0; i < outTaskId.length; i++) {
					this.mdOutTaskList.forEach(item => {
						if (item.outTaskId == outTaskId[i]) {
							if (item.statusCode != '1') {
								this.$message.error(`单据${outTaskId[i]}不是开始执行状态，请重新选择!`);
							} else {
								jsonMdOutTask(queryParams).then(response => {
									if (response.code == 200) {
										this.$message({
											message: `数据成功下载至${response.msg}中`,
											type: 'success'
										});
									} else {
										this.$message.error('数据下载失败');
									}
								})
							}
						}
					})
				}
			}
		}
	}
};
</script>
